/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package co.umb.CLienteWS.Models;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.postgresql.ds.PGPoolingDataSource;

/**
 *
 * @author Alexander Toro
 */
public class conexionDbPool {
    private static conexionDbPool conexionpool = null;
    private static PGPoolingDataSource ds = null;
    
    static {
        conexionpool = new conexionDbPool();
    }    
    private conexionDbPool(){        
        ds = new PGPoolingDataSource();
        ds.setApplicationName("postgres");
        ds.setServerName("54.174.108.201");
        ds.setPortNumber(5432);
        ds.setUser("postgres");
        ds.setPassword("www.pc.com77");
        ds.setDatabaseName("CLienteWSDB");
        ds.setMaxConnections(50);
    }    
    public static Connection obtenerConexion(){        
        try {
            return ds.getConnection();
        } catch (SQLException ex) {
            Logger.getLogger(conexionDbPool.class.getName()).log(Level.SEVERE, null, ex);
        }
        return null;
    }    
    public void cerrarConexion(){
        ds.close();
    }
}
